home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung / Power-Programmierung (Tewi)(1994).iso / magazine / dbms_mag / 9104 / foxpro.apr < prev    next >
Text File  |  1991-03-26  |  2KB  |  87 lines

  1.  
  2. *** Listing 1 
  3.  
  4. USE Timelog    && See structure in Figure 1 
  5. ZAP 
  6. APPEND FROM D:\Timelog.sdf TYPE SDF 
  7. SET TALK OFF   && Optional 
  8. lasttime = Seconds 
  9. SKIP -1 
  10. DO WHILE .NOT. BOF() 
  11.   IF m->lasttime < Seconds  
  12.                   && For the late night programmers
  13.       && (Seconds() returns seconds since midnight)
  14.     REPLACE Elapsed WITH m->lasttime+86400 - Seconds
  15.   ELSE
  16.     REPLACE Elapsed WITH m->lasttime - Seconds 
  17.   ENDIF 
  18.   lasttime = Seconds 
  19.   SKIP -1  
  20. ENDDO 
  21. REPLACE Lines WITH 1 ALL 
  22.  
  23.  
  24.  
  25. *** Listing 2
  26.  
  27. USE Prcsumry INDEX Prcsumry     && Indexed on
  28. Procname+Procfile 
  29. ZAP 
  30. handle = FOPEN('PRCSUMRY.DOC') 
  31. FOR i = 1 TO 7 
  32.     =FGETS(m->handle)   && Skip this text 
  33. ENDFOR 
  34. textstr = FGETS(m->handle) 
  35. procfiles = VAL(LEFT(m->textstr,AT(' ',m->textstr)-1))
  36.  
  37. FOR i = 1 TO m->procfiles + 2 
  38.     =FGETS(m->handle)   && Skip this text 
  39. ENDDO 
  40. FOR i = 1 TO m->procfiles 
  41.     textstr = FGETS(m->handle) 
  42.     procfile = LEFT(m->textstr,AT(' ',m->textstr)-1) 
  43.     =FGETS(m->handle)   && Skip this text 
  44.     DO WHILE .NOT. EMPTY(m->textstr) 
  45.         textstr = ALLTRIM(FGETS(m->handle)) 
  46.         IF LEFT(m->textstr,10)='Contains: ' 
  47.             procname = STRTRAN(SUBSTR(m->textstr,11,; 
  48.                        AT('',m->textstr,2)-11),'()','') 
  49.             APPEND BLANK 
  50.             GATHER MEMVAR 
  51.         ENDIF  
  52.     ENDDO 
  53.     =FGETS(m->handle)   && Skip this text 
  54.     =FGETS(m->handle)   && Skip this text 
  55. ENDFOR  
  56. CLOSE ALL 
  57.  
  58.  
  59. *** Listing 3
  60.  
  61. SELECT 2 
  62. USE Prcsumry INDEX Prcsumry 
  63. SELECT 1 
  64. USE Timelog 
  65. SET RELATION TO Program INTO Prcsumry 
  66. INDEX ON Prcsumry->Procfile+Lineno TO Temp ;
  67.  FOR .NOT. EMPTY(Prcsumry->Procfile) 
  68. DO WHILE .NOT. EOF()   
  69.   procfile = Prcsumry->Procfile  
  70.   handle = FOPEN(m->Procfile) 
  71.   filesize = FSEEK(m->handle,0,2) 
  72.   =FSEEK(m->handle,0)     && beginning of file 
  73.   bytesread = 0 
  74.   lineno = 1 
  75.   DO WHILE bytesread < m->filesize 
  76.     code = FGETS(m->handle,1024) 
  77.     IF SEEK(m->procfile+STR(m->lineno,5)) 
  78.       REPLACE Code WITH m->code 
  79.     ENDIF  
  80.     bytesread = m->bytesread + LEN(m->code)+2 
  81.     lineno = m->lineno + 1 
  82.   ENDDO 
  83.   SEEK Prcsumry->Procfile 
  84.   LOCATE FOR Prcsumry->Procfile <> m->procfile REST 
  85. ENDDO 
  86.  
  87.